﻿using System.ComponentModel;
using System.Windows.Media.Imaging;
using System;

namespace devtm.editor.Configuration
{

    public class ContainerHeader : INotifyPropertyChanged, devtm.Configuration.IContainerHeader
    {

        public ContainerHeader(bool inherited)
        {

            if (inherited)
                _inherited = System.Windows.Visibility.Visible;
            else
                _inherited = System.Windows.Visibility.Hidden;


        }

        public event PropertyChangedEventHandler PropertyChanged;

        private string _Label;


        public string Label
        {
            get { return _Label; }
            set 
            {
                if (_Label == value)
                    return;

                _Label = value; 
            
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs("Label"));
            }
        }


        private string _imageSource;
        public string ImageSource
        {
            get { return _imageSource; }
            set 
            {
                if (_imageSource == value)
                    return;

                _imageSource = value;


                _image = new BitmapImage();
                _image.BeginInit();
                _image.UriSource = new Uri(@"/devtm.Editor.Configuration;component/Images/" + _imageSource, UriKind.Relative);
                _image.EndInit();

                if (PropertyChanged != null)
                {
                    PropertyChanged(this, new PropertyChangedEventArgs("ImageSource"));
                    PropertyChanged(this, new PropertyChangedEventArgs("Image"));
                }
            }
        }


        private BitmapImage _image;
        public BitmapImage Image
        {
            get { return _image; }
        }



        public System.Windows.Visibility _inherited;
        public System.Windows.Visibility Inherited
        {
            get { return _inherited; }
            set
            {
                if (_inherited == value)
                    return;

                _inherited = value;

                if (PropertyChanged != null)
                    PropertyChanged(this, new PropertyChangedEventArgs("Inherited"));
            }
        }

        private System.Windows.Visibility _sectionInError = System.Windows.Visibility.Hidden;
        public System.Windows.Visibility SectionInError
        {
            get { return _sectionInError; }
            set
            {
                if (_sectionInError == value)
                    return;

                _sectionInError = value;

                if (PropertyChanged != null)
                    PropertyChanged(this, new PropertyChangedEventArgs("SectionInError"));
            }
        }


    }

}
